package lk.mrt.cse.wihidum.util;

import org.apache.axis2.context.*;
import org.apache.axis2.AxisFault;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.client.OperationClient;

/**
 * Created by IntelliJ IDEA.
 * User: Hasini
 * Date: Apr 29, 2010
 * Time: 5:06:50 AM
 * To change this template use File | Settings | File Templates.
 */
public class ClientConfiguration
{
    private static ConfigurationContext configurationContext;
    private static ServiceClient serviceClient;
    public static ConfigurationContext getConfigurationContext()
    {
        return configurationContext;
    }

    public static ServiceClient getServiceClient()
    {        
         try {
             if(serviceClient == null)
                serviceClient =  new ServiceClient(ClientConfiguration.getConfigurationContext(), null);
        } catch (AxisFault axisFault) {
            axisFault.printStackTrace();
        }
        return serviceClient;
    }
   
    public ClientConfiguration()
    {
         try
        {
            configurationContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,null);
        }
        catch (AxisFault axisFault)
        {
            axisFault.printStackTrace();
        }
    }
}
